package org.kwisatz.proxybot.filters;

import java.io.PrintWriter;

import org.kwisatz.proxybot.FilterAdapter;
import org.kwisatz.proxybot.Message;
import org.kwisatz.proxybot.Toolkit;

public class Memory extends FilterAdapter
{
	public String handleClientLine(String line, Message message)
	{				
		if("PRIVMSG".equals(message.getCommand()) && "!mem".equals(message.getEndOfMsg()))
		{
			String chan=message.getCmdParam();
			PrintWriter pw = Toolkit.channelWriter(context, chan);
			System.gc();
			long mem=Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory();
			pw.println((mem/1024.0/1024.0)+"Mb");
		}
		return line;		
	}	
}